<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="/page/share/taglib.jsp" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>试题中心</title>
    <link type="text/css" href="<%=basePath%>/css/base.css" rel="stylesheet"/>
    <link type="text/css" href="<%=basePath%>/css/downMenu.css" rel="stylesheet"/>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script type="text/javascript" src="../js/menu.js"></script>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script type="text/javascript" src="<%=basePath%>/js/jquery.min.js"></script>
    <script src='<%=basePath%>/js/bootstrap.min.js' type="text/javascript"></script>
    <script src='<%=basePath%>/js/testList.js' type="text/javascript"></script>
    <script src='<%=basePath%>dwr/util.js' type="text/javascript"></script>
    <script src='<%=basePath%>dwr/engine.js' type="text/javascript"></script>
    <script src='<%=basePath%>dwr/interface/subjectService.js' type="text/javascript"></script>
    <script src='<%=basePath%>dwr/interface/testCategoryService.js' type="text/javascript"></script>
    <link href='<%=basePath%>/css/bootstrap-2.3.2.css' rel='stylesheet'>
    <link href='<%=basePath%>/css/table-fixed-header.css' rel='stylesheet'>
    <script src='<%=basePath%>/js/table-fixed-header.js' type="text/javascript"></script>

    <link rel="stylesheet" type="text/css" href="<%=basePath%>/css/component.css"/>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>/css/default.css"/>
    <script type="text/javascript" src="<%=basePath%>/js/modernizr.custom.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/jquery.dlmenu.js"></script>

    <link rel="stylesheet" type="text/css" href="<%=basePath%>/css/testList.css"/>
    <style type="text/css">
    </style>


    <script type="text/javascript">
        $(document).ready(function () {
            sortArrow();
            testCategoryService.allTestCategory(allCategory);
            subjectService.allSubject(findSubject);

            $('.table-fixed-header').fixedHeader();
        });
        function allCategory(categories) {
            var li = "";
            var tag_span = '<span class="tag"><a href="javascript:void(0);" tag="0">不限</a></span>';
            for (var i = 0; i < categories.length; i++) {
                li = li + '<li><a href="' + "<%=basePath%>" + "page/test/addTest.jsp?categoryId=" +
                        categories[i].id +
                        '">' + categories[i].type + "</a></li>";
                tag_span =
                        tag_span +'<span class="tag "><a href="javascript:void(0);"  tag="'+categories[i].id+'">'+categories[i].type+'</a></span>';
            }

            $('#menuCategory').html(li);
            $('.tag_category').append(tag_span);
            $('.tag_category>.tag>a').click(function(){
                searchTag("searchCategory",$(this).attr("tag"));
                topage('1');
            });
            searchTagChooce();


        }

    </script>

</head>

<body>
<%@ include file="/page/share/menu.jsp" %>

<div id="content" style="width: 1200px;">
    <h2>试题中心</h2>
    <hr>
    <div class="container ">
        <div class="btn-group">
            <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
                添加试题 <span class="caret"></span>
            </button>
            <ul class="dropdown-menu" role="menu" id="menuCategory">

            </ul>
        </div>
    </div>


    <form action="Test!getList.action" method="post" id="myform">
        <input type="hidden" name="page" value="" id="page"/>
        <input type="hidden" name="orderByname" value="${orderByname}" id="orderByname"/>
        <input type="hidden" name="orderBy" value="${orderBy}" id="orderBy"/>
        <input type="hidden" name="account" value="${person.accout}"/>

        <input type="hidden" name="searchCategory" value="${searchCategory}" id="searchCategory"/>
        <input type="hidden" name="searchSubject" value="${searchSubject}" id="searchSubject"/>


        <%--<table style="margin:10px 25px;border-collapse:collapse;">--%>
        <table style="margin:20px 45px;border-collapse:collapse;width: 1100px;"
               class='table table-bordered table-striped table-fixed-header table-hover'>
            <thead class='header'>
            <tr style="">
                <td colspan="5" style="background-color: #FFFFFF;border: none;">
                    <!-- 搜索面包屑 -->
                    <div class="breadcrumb" style="margin-bottom: 10px;">
                        <span class="title">已选择条件：</span>

                        <div style=" float: right;">
                            <a style="display: inline;color: #0088CC;text-decoration: none;" href="javascript:void(0);"
                               onclick="toggleSearchbutton()" class="searchName">+筛选条件</a>
                            <a style="display: none;color: #0088CC;text-decoration: none;"
                               href="javascript:void(0);" onclick="toggleSearchbutton()"
                               class="searchName">-收起筛选条件</a>
                        </div>
                    </div>

                    <!-- 标签列表 -->
                    <div style="display: none;" class="tag-search" id="tag-search">
                        <div class="tags" >
                            <div class="tag-cate" style="margin-bottom: 5px;"> 按科目：</div>
                            <div class="tag-list tag_subject" >

                            </div>
                        </div>

                        <div class="tags">
                            <div class="tag-cate"> 按题型：</div>
                            <div class="tag-list tag_category">

                            </div>
                        </div>
                    </div>

                </td>
            </tr>
            <tr>
                <td colspan="5" bgcolor="#4b0050" align="right" style="padding-right: 10px;height: 20px;">
                    <%@ include file="/page/share/fenye.jsp" %>
                </td>
            </tr>
            <tr>
                <th colspan='1' rowspan='1' style="width: 50px;"
                    onmouseover="$(this).css('cursor','pointer');"
                    onclick="sortby(this);" id="sort_no">
                    题目编号
                </th>
                <th colspan='1' rowspan='1' style="width: 30px;"
                    onmouseover="$(this).css('cursor','pointer');" onclick="sortby(this);" id="sort_type">
                    题型
                </th>
                <th colspan='1' rowspan='1' style="width: 100px;" onmouseover="$(this).css('cursor','pointer');"
                    onclick="sortby(this);" id="sort_subject">
                    科目
                </th>
                <th colspan='1' rowspan='1' style="width: 400px;">
                    题目
                </th>
                <th colspan='1' rowspan='1' style="width: 200px;">
                    答案
                </th>
            </tr>
            </thead>
            <c:if test="${pageView.totalRecord==0}">
                <tr>
                    <td style="width: 780px;text-align: center;" colspan="5">无数据</td>
                </tr>
            </c:if>
            <s:iterator value="pageView.records" var="test">

                <tr class="theTestsTr" id="theTestsTr<s:property value="#test.id"/>"
                    >

                    <td align="center" class="theFirstTd" style="width: 50px;">
                        <div style="margin:15px 0; ">
                    <span class="label label-warning" style="font-size: 80%;"><s:property
                            value="#test.testId"/></span></div>

                    <td align="center" style="width: 30px;">
                        <div style="margin:15px 0; ">
                          <span class="label label-primary" style="font-size: 80%;"><s:property
                                  value='#test.category.type'/></span></div>
                    </td>

                    <td align="center" style="width: 100px;">
                        <s:property value="#test.subject.subjectName"/>
                        &nbsp;
                    </td>
                    <td align="left" class="the_themes" style="width: 400px;word-break:break-all;">
                        <s:property value="#test.theme" escape="false"/>
                        &nbsp;

                    </td>

                    <c:if test="${test.category.type=='判断题'}">
                        <td class="testAnswerTd" align="center"
                            onclick="slideThePanel(<s:property value="#test.id"/>)"
                            style="width: 200px;word-break:break-all;">
                            <c:if test="${test.answer.answer=='T'}">
                                说法正确
                            </c:if>
                            <c:if test="${test.answer.answer=='F'}">
                                说法错误
                            </c:if>
                        </td>
                    </c:if>
                    <c:if test="${test.category.type=='问答题'}">
                        <td class="testAnswerTd"
                            onclick="slideThePanel(<s:property value="#test.id"/>)"
                            style="width: 200px;word-break:break-all;">
                            <s:property value="#test.answer.answer" escape="false"/>
                        </td>
                    </c:if>
                    <c:if test="${test.category.type!='判断题'&&test.category.type!='问答题'}">
                        <td class="testAnswerTd" align="center"
                            onclick="slideThePanel(<s:property value="#test.id"/>)"
                            style="width: 200px;word-break:break-all;">
                            <s:property value="#test.answer.answer"/>
                        </td>
                    </c:if>


                </tr>

                <tr class="panel" style="display:none;" id="testsPanel<s:property value="#test.id"/>" align="right">
                    <td align="right" style="width: 50px;">
                        <div style="margin:15px 0; ">
                            <span class="label label-danger" style="font-size: 80%;">难度</span>
                            <s:property
                                    value="#test.difficulty"/>
                        </div>
                    </td>
                    <td align="left" style="width: 30px;">

                    </td>
                    <td align="left" style="width: 100px;">

                    </td>
                    <td align="left" style="width: 400px;">
                        <div style="margin:15px 0; ">
                            <span class="label label-danger" style="font-size: 80%;">答案解析</span>
                            <s:property
                                    value="#test.answer.answerKeys"/>
                        </div>
                    </td>
                    <td align="left" style="width: 200px;">
                        <button type="button" class="btn btn-primary " >
                            编辑
                        </button>
                        <button type="button" class="btn btn-danger " >
                            删除
                        </button>
                    </td>
                </tr>
            </s:iterator>

        </table>
    </form>

</div>

<div id="footer">
    <p style="text-align: center;color: #757575;padding: 20px 0px 0px 0px; font:12px;">Copyright © 2010-2013 蓝天白云团队
        版权所有</p>
</div>
</body>
</html>
